import requests

url = "http://www.baidu.com"


def test_get():
    """
    基本请求
    """
    resp = requests.get(url);

    #
    print(resp.text)


def test_params():
    """
    参数
    """
    resp = requests.get(url=url);
    print(resp.status_code)
    print(resp.text)


def test_header():
    """
    请求头
    """
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36'
    }
    #
    resp = requests.get(url=url, headers=headers);
    print(resp.status_code)
    print(resp.text)


def test_cookies():
    """
    Cookies
    """
    cookies = {
        'user_session': 'wGMHFJKgDcmRIVvcA14_Wrt_3xaUyJNsBnPbYzEL6L0bHcfc',
    }

    resp = requests.get('https://github.com/settings/emails', cookies=cookies)
    print('123456@qq.com' in resp.text)  # True
